package com.zy.service.impl;



import com.zy.domain.User;
import com.zy.repo.UserRepo;
import com.zy.service.UserService;
import com.zy.service.form.Message;
import com.zy.service.form.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by ab804 on 2015/9/25 0025.
 */
@Service("userService")
public class UserServiceImpl implements UserService {

    @Autowired
    UserRepo userRepo;


    @Override
    public Message addUser(UserInfo userInfo) {

        User user = new User();
        user.setName(userInfo.getName());
        user.setAge(userInfo.getAge());
        userRepo.saveAndFlush(user);
        Message message = new Message();
        message.setCode(Message.SUCCESS);
        message.setMsg("添加成功");
        return message;


    }
}
